﻿using MyNeighbourhood.Data;
using MyNeighbourhood.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace MyNeighbourhood.Models
{
    public class EventModel
    {
        public int EventId { get; set; }

        [Required]
        public EventType EventType { get; set; }

        [Required]
        public string Name { get; set; }                
        
        public int Day { get; set; }
        public int Month { get; set; }
        public int Year { get; set; }

        [DataType(DataType.Date)]
        public DateTime? Date { get; set; }

        [DataType(DataType.Time)]
        [DisplayFormat(DataFormatString = @"{0:hh\:mm}", ApplyFormatInEditMode=true)]
        public DateTime? Time { get; set; }

        [Required]
        public bool IsPublic { get; set; }

        public virtual LocationModel Location { get; set; }

        [DataType(DataType.PhoneNumber)]
        public string Phone { get; set; }

        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [DataType(DataType.Url)]
        public string Website { get; set; }

        public List<TargetCheck> TargetCheck { get; set; }
        public virtual List<TargetType> Target { get; set; }
        public string OtherTargets { get; set; }

        [DataType(DataType.MultilineText)]
        [DisplayFormat(NullDisplayText="Няма")]
        public string AdditionalInfo { get; set; }

        [DataType(DataType.Upload)]
        public string Presentation { get; set; }

        public virtual List<ParticipantModel> Participants { get; set; }
        
        public EventModel()
        {
            this.Day = 0;
            this.Month = 0;
            this.Year = 0;

            this.Participants = new List<ParticipantModel>();            
            this.Target = new List<TargetType>();
            this.TargetCheck = new List<TargetCheck>();
        }
    }
}